const { resolve } = require('path')
const r = path => resolve(__dirname, path)

// cnpm i babel-core babel-preset-stage-3@6.24.1 babel-preset-latest-node@0.2.2 babel-polyfill -D
// latest-node 0.2.2 版本正常使用
// 支持最新的es6语法
require('babel-core/register')({
  'presets': [
    'stage-3',
    'latest-node'
  ],
  // es7 装饰器decorator 语法的兼容所要安装的解析器 
  // cnpm i babel-plugin-module-alias babel-plugin-transform-decorators-legacy -D
  'plugins': [
    'transform-decorators-legacy',
    [
      'module-alias', [
        {
          src: r('./server'), 'expose': '~',
          src: r('./server/database'), 'expose': 'database'
        }
      ]
    ]
  ]
  // es7 装饰器decorator 语法的兼容所要安装的解析器 
})

require('babel-polyfill')
// require('./server')
require('./server')
